﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using M3G;

namespace MyTestProject {
    
    public class TestAppearanceBase {
        [Fact]
        public void TestConstructor () {
            var app = new Appearance ();

            Assert.Equal (0, app.Layer);
            Assert.Equal (null, app.CompositingMode);
            Assert.Equal (null, app.PointSpriteMode);
            Assert.Equal (false, app.DepthSortEnabled);
        }


        [Fact]
        public void TestSetLayer () {
            var app = new Appearance ();
            app.Layer = 10;

            Assert.Equal (10, app.Layer);
        }

        [Fact]
        public void TestSetCompositingMode () {
            var app = new Appearance ();
            var cmode = new CompositingMode ();
            app.SetCompositingMode (cmode);

            Assert.Equal (cmode, app.CompositingMode);
        }


        [Fact]
        public void TestSetPolygonMode () {
            var app = new Appearance ();
            var pmode = new PolygonMode ();
            app.SetPolygonMode (pmode);

            Assert.Equal (pmode, app.PolygonMode);
        }

        [Fact]
        public void TestSetDepthSortEnabled () {
            var app = new Appearance ();
            app.DepthSortEnabled = true;

            Assert.Equal (true, app.DepthSortEnabled);
        }

        [Fact]
        public void TestDuplicate () {
            var app = new Appearance ();
            var cmode = new CompositingMode ();
            var pmode = new PolygonMode ();
            app.Layer = 10;
            app.SetCompositingMode (cmode);
            app.SetPolygonMode (pmode);
            app.DepthSortEnabled = true;

            var dup = (Appearance)app.Duplicate ();

            Assert.Equal (app.Layer, dup.Layer);
            Assert.Equal (app.CompositingMode, dup.CompositingMode);
            Assert.Equal (app.PolygonMode, dup.PolygonMode);
            Assert.Equal (app.DepthSortEnabled, dup.DepthSortEnabled);
        }
    }
}
